package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.DailyWorkMapper;
import com.ruoyi.system.domain.DailyWork;
import com.ruoyi.system.service.IDailyWorkService;

/**
 * 日报Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-08-13
 */
@Service
public class DailyWorkServiceImpl implements IDailyWorkService 
{
    @Autowired
    private DailyWorkMapper dailyWorkMapper;

    /**
     * 查询日报
     * 
     * @param id 日报主键
     * @return 日报
     */
    @Override
    public DailyWork selectDailyWorkById(Long id)
    {
        return dailyWorkMapper.selectDailyWorkById(id);
    }

    /**
     * 查询日报列表
     * 
     * @param dailyWork 日报
     * @return 日报
     */
    @Override
    @DataScope(deptAlias = "dept", userAlias = "u")
    public List<DailyWork> selectDailyWorkList(DailyWork dailyWork)
    {
        return dailyWorkMapper.selectDailyWorkList(dailyWork);
    }

    /**
     * 新增日报
     * 
     * @param dailyWork 日报
     * @return 结果
     */
    @Override
    public int insertDailyWork(DailyWork dailyWork)
    {
        dailyWork.setCreateTime(DateUtils.getNowDate());
        return dailyWorkMapper.insertDailyWork(dailyWork);
    }

    /**
     * 修改日报
     * 
     * @param dailyWork 日报
     * @return 结果
     */
    @Override
    public int updateDailyWork(DailyWork dailyWork)
    {
        dailyWork.setUpdateTime(DateUtils.getNowDate());
        return dailyWorkMapper.updateDailyWork(dailyWork);
    }

    /**
     * 批量删除日报
     * 
     * @param ids 需要删除的日报主键
     * @return 结果
     */
    @Override
    public int deleteDailyWorkByIds(Long[] ids)
    {
        return dailyWorkMapper.deleteDailyWorkByIds(ids);
    }

    /**
     * 删除日报信息
     * 
     * @param id 日报主键
     * @return 结果
     */
    @Override
    public int deleteDailyWorkById(Long id)
    {
        return dailyWorkMapper.deleteDailyWorkById(id);
    }
}
